<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
             
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html>
  <head>
    <base href="<%=basePath%>"> 
    
    <title>My JSP 'index.jsp' starting page</title>
    	<script type="text/javascript" src="js/jquery-1.8.0.js"></script> 
    	<link rel="stylesheet" type="text/css" href="css/maintable.css" ></link>
    <script>
    function jump (max){
			var pageIndex=document.getElementById("pageIndex").value
			if(pageIndex>0&&pageIndex<=max){
				window.location.href="RoleServlet.do?flag=listadmin&pageIndex="+pageIndex;
			}
			else{
				alert("输入页码有误,请重新输入");
			}
		}
    </script>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	
	
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  <div class ="div_title">
						<div class="div_titlename"> <img src="images/san_jiao.gif" ><span>角色列表</span></div>
		  	<div class="div_titleoper"></div>
				 </div>
		 <form action="xxx"  name="form1"  id="from1"  method="post">
				 <table class="main_table" >
				       <tr>
				 					<th>账号</th> 	<th width="10%">状态</th>	<th width="15%">用户角色</th>  <th width="35%">最后更新日期</th><th width="20%">操作</th>
				 		</tr>
				 		
				 		<c:forEach var="admin" items="${adminList }">
				 		<tr>
				 				<td>${admin.adminName}</td>	
				 				<td>
				 				<c:choose>
								 		<c:when test="${admin.state==2}">已锁定</c:when>
								 		<c:when test="${admin.state==1}"></c:when>	
								</c:choose>
				 				</td>	
				 				<td>${admin.roleName}</td>
				 				<td>${admin.editDate }</td>
				 				<td>
				 				<c:choose>
								 		<c:when test="${admin.state==2}"></c:when>
								 		<c:when test="${admin.state==1}"><a href="perm/adminrole_edit.jsp?id=${admin.id}">角色分配</a> </c:when>	
								</c:choose>
				 				</td>
				 		</tr>
				 		</c:forEach>
				</table>
				</form>
				<div class="div_page" >
					  <div class="div_page_left">    共有 <label>${page.rowCount}</label> 条记录，当前第 <label>${page.pageIndex}</label> 页，共 <label>${page.pageCount }</label> 页	</div>		
					  <div class="div_page_right" >
					  <c:choose> 	 
					  			<c:when test="${page.hasPre}">
					  			 <a href="RoleServlet.do?flag=listadmin&pageIndex=1">首页</a>
				  	 			 <a href="RoleServlet.do?flag=listadmin&pageIndex=${page.pageIndex-1}">上一页</a>
					  			 </c:when>
					  			 <c:otherwise>
									首页
									上一页
								 </c:otherwise>
								 </c:choose>
								 <c:choose> 	
								 <c:when test="${page.hasNext}">
					  			 <a href="RoleServlet.do?flag=listadmin&pageIndex=${page.pageIndex+1}">下一页</a>
					  			 <a href="RoleServlet.do?flag=listadmin&pageIndex=${page.pageCount }">尾页</a>
				  	 		   	 </c:when>
								 <c:otherwise>
									下一页
									尾页
								 </c:otherwise>
								 </c:choose>
					  	  <button onclick=jump(${page.pageCount})>转到</button>
					  	 <input type="text" name="pageIndex" id="pageIndex" value="${page.pageIndex}" /> 页
					  	
					   </div>
						
				</div>
	 </body>
</html>